package com.swak.persistence.mybatis.enhance;

import org.mybatis.spring.mapper.MapperFactoryBean;

import com.swak.persistence.proxy.ProxyFactory;

/**
 * 优化 Mapper 的调用体系
 * 
 * @author lifeng
 * @date 2021/03/18
 */
public class EnhanceMapperFactoryBean<T> extends MapperFactoryBean<T> {

    public EnhanceMapperFactoryBean(Class<T> mapperInterface) {
        super(mapperInterface);
    }

	@Override
	@SuppressWarnings("unchecked")
    public T getObject() throws Exception {
        return (T) ProxyFactory.newProxy(this.getMapperInterface(), this.getSqlSessionTemplate());
    }
}